package com.elitesland.org.entity;

import com.elitesland.core.base.BaseModel;
import com.elitesland.system.annotation.Comment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Objects;

@Entity
@Table(name = "org_employee")
@org.hibernate.annotations.Table(appliesTo = "org_employee", comment = "雇员信息")
@Data
@Accessors(chain = true)
@ApiModel(value = "雇员信息", description = "雇员信息")
public class EmployeeDO extends BaseModel implements Serializable {
    private static final long serialVersionUID = -2361709255059220486L;

    @ApiModelProperty(value = "雇员编号")
    @Comment("雇员编号")
    @Column()
    String empNo;

    @ApiModelProperty(value = "雇员姓名")
    @Comment("雇员姓名")
    @Column()
    String name;

    @ApiModelProperty(value = "雇员外文名")
    @Comment("雇员外文名")
    @Column()
    String foreignName;

    @ApiModelProperty(value = "所属OU ID")
    @Comment("所属OU ID")
    @Column()
    Long ouId;

    @ApiModelProperty(value = "所属BU ID")
    @Comment("所属BU ID")
    @Column()
    Long buId;

    @ApiModelProperty(value = "汇报雇员记录ID")
    @Comment("汇报雇员记录ID")
    @Column()
    Long reportToId;

    @ApiModelProperty(value = "汇报ID路径")
    @Comment("汇报ID路径")
    @Column()
    String reportToPath;

    @ApiModelProperty(value = "岗位记录ID")
    @Comment("岗位记录ID")
    @Column()
    Long postId;

    @ApiModelProperty(value = "行政职位, [UDC]ORG:TITLE")
    @Comment("行政职位, [UDC]ORG:TITLE")
    @Column()
    String title;

    @ApiModelProperty(value = "系统用户ID")
    @Comment("系统用户ID")
    @Column()
    Long sysUserId;

    @ApiModelProperty(value = "系统用户账号")
    @Comment("系统用户账号")
    @Column()
    String sysUserName;

    @ApiModelProperty(value = "工作邮箱")
    @Comment("工作邮箱")
    @Column()
    String email;

    @ApiModelProperty(value = "工作手机号")
    @Comment("工作手机号")
    @Column()
    String mobile;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof EmployeeDO)) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        EmployeeDO entity = (EmployeeDO) o;
        return getId().equals(entity.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId());
    }
}